<template>
	<header class="cart-header">
		<div
				class="cart-header-action"
				v-if="cartHeaderFlag"
		>
			<span
					class="cart-header-update"
					v-show="update"
					@click="actionClick(false)"
			>
				编辑
			</span>
			<span
					class="cart-header-save"
					v-show="!update"
					@click="actionClick(true)"
			>
				完成
			</span>
		</div>
		<div>购物车</div>
	</header>
</template>

<script>
	export default {
		name: "Header",
		props: {
			cartHeaderFlag: {
				type: Boolean,
				required: true
			},
			update: {
				type: Boolean,
				required: true
			}
		},
		methods: {
			actionClick(flag) {
				this.$emit('changeAction', flag)
			}
		}
	}
</script>
